import instance from "./request";
import qs from "qs";

// export const GetCaptchaCodeApi = () => instance.get("/prod-api/captchaImage");
export const LoginApi = (params) => instance.post("/managentstore/login", qs.stringify(params));

// /home 首页统计表
export const HomeApi = () => instance.get("/managentstore/home");

// /goods 货物请求
export const GoodsApi = () => instance.get("/managentstore/goods");

// /goods/add 货物新增请求
export const addGoodApi = (params) => instance.put("/managentstore/goods/add", qs.stringify(params));

// /goods/delete/:id 删除货物请求
export const delGoodApi = (params) => instance.delete(`/managentstore/goods/delete/${params}`);

// /managentstore/goods/rent 租借货物请求
export const RentGoods = (params) => instance.post("/managentstore/goodsrent", qs.stringify(params));

// /serachgoods 货物模糊搜索
export const serachApi = (params) => instance.post("/managentstore/serachgoods", qs.stringify(params));

// /managentstore/rentNote 管理员的租借请求
export const rentNodeApi = () => instance.get("/managentstore/rentNote");

// /managentstore/rentNote/delete/:id 删除租借记录
export const delrentNodeApi = (params) => instance.delete(`/managentstore/rentNote/delete/${params}`);

// /managentstore/rentRequests 用户查看租借请求
export const rentRequestsApi = () => instance.get("/managentstore/rentRequests");

// 管理员查看租借请求
export const goodsRentApi = () => instance.get("/managentstore/adminRent");

// 管理员是否同意租借请求 /managentstore/rentRequest/agree
export const AgreeApi = (params) => instance.post("/managentstore/rentRequest/agree", qs.stringify(params));

// /managentstore/rentRequests/returned 归还请求
export const returnApi = (params) => instance.post("/managentstore/rentRequests/returned", qs.stringify(params));

// /managentstore/rentRequests/cancel/:rentreqid 撤销请求
export const cancelApi = (params) => instance.post(`/managentstore/rentRequests/cancel/:${params}`);

// /managentstore/rerentRequest/personal 个人中心
export const personalApi = (params) => instance.get("/managentstore/personal", params);

// /managentstore/rerentRequest/revise 修改密码
export const reviseApi = (params) => instance.post("/managentstore/revise", qs.stringify(params));

// /managentstore/rerentRequest/log 新建每日日志
export const newlogApi = () => instance.post("/managentstore/log");

// /flush 刷新数据库资源
export const flushApi = () => instance.put("/managentstore/flush");